package net.laenzlinger.decision.service;

import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderErrors;

@SuppressWarnings("serial")
public class KnowledgeBuilderException extends Exception {

	private final KnowledgeBuilderErrors errors;

	public KnowledgeBuilderException(KnowledgeBuilderErrors errors) {
		this.errors = errors;
	}

	public KnowledgeBuilderErrors getErrors() {
		return errors;
	}

	@Override
	public String toString() {
		StringBuilder result = new StringBuilder();
		for (KnowledgeBuilderError error : errors) {
			result.append(error).append("\n");

		}
		return result.toString();
	}

}
